﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GLinq
{
    public class Buffer<T> : Mergeable
    {
        internal GLinqExpression Expression;
        
        internal Buffer(GLinqExpression expr)
        {
            this.Expression = expr;
        }

        public int Count { get { throw new NotImplementedException(); } }

        public static Buffer<T> Create(int length, string dataSource)
        {
            return new Buffer<T>(new InputBufferExpression(length, typeof(T), dataSource));
        }

        public ConsumableQueue<T> ToConsumableQueue()
        {
            return new ConsumableQueue<T>(this);
        }

        public static Buffer<int> Enumerate(int length, int start, int step)
        {
            return new Buffer<int>(new InputBufferExpression(length, typeof(int), string.Format("{0}:{1}", start, step)));
        }
        public static Buffer<float> Enumerate(int length, float start, float step)
        {
            return new Buffer<float>(new InputBufferExpression(length, typeof(float), string.Format("{0}:{1}", start, step)));
        }

    }

    public class ConsumedBuffer<T> : Buffer<T>
    {
        internal ConsumedBuffer(GLinqExpression expr)
            : base(expr)
        { }
    }
}
